package org.example.demo1.Controller;


import org.example.demo1.Controller.vo.ResultVO;
import org.springframework.http.HttpStatus;

/**
 * ClassName: BaseController
 * Description:
 *
 * @Author L_Z_R
 * @Create 2025/05/13 19:21
 * @Version 1.0
 */
public class BaseController {
    /**
     * 响应成功(带数据)
     * @param data 数据
     * @return ResultVO
     * @param <T> 数据类型
     */
    protected <T> ResultVO<T> success(T data) {
        ResultVO<T> vo = new ResultVO<>();
        vo.setCode(HttpStatus.OK.value());
        vo.setData(data);
        return vo;
    }

    /**
     * 响应成功(无数据)
     * @return ResultVO
     */
    protected <T> ResultVO<T> success() {
        ResultVO <T> vo = new ResultVO<>();
        vo.setCode(HttpStatus.OK.value());
        return vo;
    }
}
